#include<bits/stdc++.h>

using namespace std;

int main() {
	int a[]={1,2,4,4,6,10,123,125,200};
	int n=sizeof(a)/sizeof(a[0]);
	sort(a,a+n);
	int key=125;	
	int flag=0;
	int left=0,right=n-1;
	while(left<=right){
		int mid=(left+right)/2;
		if(a[mid]==key){
			flag=1;
			cout<<mid<<endl;
			break;
		}else if(a[mid]>key){
			right=mid-1;
		}else{
			left=mid+1;
		}			
	}
	if(flag==0)
		cout<<-1<<endl;
	return 0;
}
